/*
 * Copyright 2009 Brian Mackay brianwmackay@msn.com
 *   All Rights Reserved. See end of file
 */
package com.bmackay.vonsteuben.job.control;

import com.bmackay.semweb.commons.modeling.services.iterators.SequenceIterator;
import com.bmackay.vonsteuben.job.mapred.base.JobDrivers;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.rdf.model.Model;
import org.apache.hadoop.mapred.jobcontrol.JobControl;

public class SequenceProccessing {

    public JobControl sequence(Model model) {

        VonSteubenJobControl vonSteubenJobControl = new VonSteubenJobControl();
        JobDrivers jobDrivers = new JobDrivers();
        StepProccessing stepProccessing = new StepProccessing();

        try {

            SequenceIterator sequenceIterator = new SequenceIterator(model);

            for (SequenceIterator it = sequenceIterator; it.hasNext();) {

                Node nextProcessNode = it.nextProcessNode();
                stepProccessing.execute(nextProcessNode, model, jobDrivers);
            }
        } catch (Exception e) {
            System.out.println("!! SequenceProccessing:error" + e + "\n");
        }

        return vonSteubenJobControl.set(jobDrivers);
    }
}
/*
 * Copyright 2009 Brian Mackay brianwmackay@msn.com
 * All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */